<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <br>
            <br>

            <div class="layui-form-item">
                <label class="layui-form-label">站点名称</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <input type="text" name="site_title" value="{$option.site_title}" required  lay-verify="required" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">站点的名称，将会展示在个页面的标题尾部、邮件中。</div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">站点LOGO</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <input type="text" name="site_logo" value="{$option.site_logo}" required  lay-verify="required" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">站点logo路径</div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">网站首页</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <select name="index_theme" lay-verify="required">
                        <option value="default" {eq name="$option.index_theme" value="default"}selected{/eq}>旧版主题</option>
                        <option value="new1" {eq name="$option.index_theme" value="new1"}selected{/eq}>新版主题</option>
                    </select>
                    <div class="layui-form-mid layui-word-aux">网站首页主题</div>
                </div>
            </div>

            <br>

            <div class="layui-form-item">
                <label class="layui-form-label">SEO标题</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <input type="text" name="site_name" value="{$option.site_name}" required  lay-verify="required" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">位于首页meta标签内的站点标题</div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">SEO关键词</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <input type="text" name="site_keywords" value="{$option.site_keywords}" required  lay-verify="required" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">位于首页meta标签内的站点关键词</div>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">SEO描述</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <textarea name="site_desc" placeholder="位于首页meta标签内的SEO描述" class="layui-textarea">{$option.site_desc}</textarea>
                </div>
            </div>

            <br>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">网站头部</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <textarea name="site_head" placeholder="网站头部代码，用于百度站长等工具验证" class="layui-textarea">{$option.site_head}</textarea>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">网站底部</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <textarea name="site_foot" placeholder="网站底部代码，你可以在此放置统计代码" class="layui-textarea">{$option.site_foot}</textarea>
                </div>
            </div>

            <br>

            <div class="layui-form-item">
                <label class="layui-form-label">站点邮箱</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <input type="text" name="site_email" value="{$option.site_email}" required  lay-verify="required" autocomplete="off" class="layui-input">
                    <div class="layui-form-mid layui-word-aux">站点的用户投诉举报邮箱</div>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">客服信息</label>
                <div class="layui-input-block" style="max-width: 800px;">
                    <textarea name="site_kefu" placeholder="" class="layui-textarea">{$option.site_kefu}</textarea>
                </div>
            </div>

            <br>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存设置</button>
                </div>
            </div>

        </div>
    </div>
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script>
    layui.use(['form','jquery'],function(){
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(save)', function(data){
            $.ajax({
                data:JSON.stringify(data.field),
                dataType:'json',
                contentType:'application/json',
                type:'post',
                success:function(res){
                    //判断有没有权限
                    if(res && res.code == 999){
                        layer.msg(res.msg, {
                            icon: 5,
                            time: 2000,
                        })
                        return false;
                    }else if(res.code == 200){
                        layer.msg(res.msg,{icon:1,time:1000},function(){
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        });
                    }else{
                        layer.msg(res.msg,{icon:2,time:1000});
                    }
                }
            })
            return false;
        });
    })
</script>
</body>
</html>